package com.sky.controller.admin;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Slf4j
@Api(tags = "门店管理接口")
public class ShopController {
    @Autowired
    StringRedisTemplate stringRedisTemplate;
    @PutMapping("/{status}")
    @ApiOperation(value = "修改门店状态")
    public Result setStatus(@PathVariable Integer status ) {
        stringRedisTemplate.opsForValue().set("shopStatus", String.valueOf(status));
        return Result.success();
    }
    @GetMapping("/status")
    @ApiOperation(value = "获取门店状态")
    public Result<Integer> getStatus() {
        return Result.success(Integer.valueOf(stringRedisTemplate.opsForValue().get("shopStatus")));
    }
}
